package controller;

import service.ScholarshipEvaluationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/evaluation")
public class ScholarshipEvaluationController {

    @Autowired
    private ScholarshipEvaluationService evaluationService;

    @GetMapping("/eligible/{studentId}")
    public boolean isEligible(@PathVariable int studentId) {
        return evaluationService.isEligible(studentId);
    }

    @GetMapping("/moral/{studentId}")
    public float moral(@PathVariable int studentId) {
        return evaluationService.calculateMoralScore(studentId);
    }

    @GetMapping("/academic/{studentId}")
    public float academic(@PathVariable int studentId) {
        return evaluationService.calculateAcademicScore(studentId);
    }

    @GetMapping("/research/{studentId}/{grade}")
    public float research(@PathVariable int studentId, @PathVariable int grade) {
        return evaluationService.calculateResearchScore(studentId, grade);
    }

    @GetMapping("/service/{studentId}")
    public float service(@PathVariable int studentId) {
        return evaluationService.calculateSocialServiceScore(studentId);
    }

    @GetMapping("/total/{studentId}/{grade}")
    public float total(@PathVariable int studentId, @PathVariable int grade) {
        return evaluationService.calculateTotalScore(studentId, grade);
    }
}